﻿using Cookbook.Services.Core.Domain;

using FluentNHibernate.Automapping;
using FluentNHibernate.Automapping.Alterations;

namespace Cookbook.Services.Core.Persistency.MappingOverrides
{
    public class RecipeMappingOverride : IAutoMappingOverride<Recipe>
    {
        public void Override(AutoMapping<Recipe> mapping)
        {
            mapping.Map(x => x.Title).Unique();
            mapping.HasMany(x => x.Ingredients).Cascade.AllDeleteOrphan().Access.CamelCaseField();
        }
    }
}
